package com.bys.system.controller;

import com.bys.response.Result;
import com.bys.system.service.ISysPostService;
import com.bys.system.vo.PostVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * 岗位信息表 前端控制器
 * </p>
 *
 * @author bys
 * @since 2023-03-31
 */
@Api(tags = "岗位接口")
@RestController
@RequestMapping("/system/sysPost")
public class SysPostController {
    @Resource
    private ISysPostService postService;
    @ApiOperation(value = "查询所有的岗位",notes = "返回 post_code,name")
    @GetMapping("/findAllPost")
    public Result getAllPost(){
        List<PostVo> postData = postService.list().stream().map(s -> new PostVo(s.getId(), s.getName())).collect(Collectors.toList());
        return Result.success(postData);
    }

}
